#!/usr/bin/env python
# coding=utf-8

		
from decimal import *

class Dest:
	
	'''
		词语各项因子所设定比重权值
	'''
	A=0.59             #词频因子比重系数
	B=0.12             #词长因子比重系数
	C=0.29             #词位因子比重系数
	
	'''
		词语所处位置所设加权值
	'''
	w_title=5      #标题加权值
	w_descr=3      #描述加权值
	w_artic=2      #正文加权值
	   

	def __init__(self,_id='',_oid='',_dest='',_prepath='',_alias01='',_alias02='',_alias03=''):
		self.oid=_oid
		self.id=_id
		self.full='^'
		self.dest=_dest
		self.prepath=_prepath
		self.alias01=_alias01
		self.alias02=_alias02
		self.alias03=_alias03
		self.length=len(self.dest)
		self.right=True
		self.pic='no_photo.jpg'
		count=len(_id)/3
		for i in range(count):
			self.full+=_id[i*3:3+3*i]
			if i<count-1:
				self.full+='/'
		#self.full=_prepath+'/'+_dest
		
	def setWP(self,_maxlen=0,_freq=0,_adds=(0,0,0)):
		#词长因子
		self.len = round(len(self.dest)/_maxlen,5)
		#词频因子
		self.freq = round(_freq/(_freq+1),5)
		#词位频率因子
		self.adds = round((self.w_title*_adds[0]+self.w_descr*_adds[1]+self.w_artic*_adds[2])/(self.w_title+self.w_descr+self.w_artic),5)
		#综合权值
		self.weight = round(self.A*self.freq + self.B*self.len + self.C*self.adds,5)
		#总权值
		self.t_weight = round(self.weight,5)

if __name__ == '__main__':
    dic={'111':'value3','222':'value2'}
    l=dic.values()
    l.sort(cmp=None, key=None, reverse=False)
    print l
    t='001001034002030'
    count=len(t)/3
    tt=''
    for i in range(count):
		tt+=t[i*3:3+3*i]
		if i<count-1:
			tt+='/'
    print tt